// 模拟用户数据
const mockUsers = {
    // 管理员账号
    'admin': {
        password: 'admin123',
        role: 'ADMIN',
        name: '管理员',
        permissions: [
            'system:all',
            'workorder:all',
            'equipment:all',
            'inspection:all',
            'user:all'
        ]
    },
    // 科室主任账号
    'manager': {
        password: 'manager123',
        role: 'MANAGER',
        name: '科室主任',
        permissions: [
            'workorder:view',
            'workorder:create',
            'workorder:approve',
            'equipment:view',
            'inspection:view',
            'inspection:create'
        ]
    },
    // 普通用户账号
    'user': {
        password: 'user123',
        role: 'STAFF',
        name: '普通用户',
        permissions: [
            'workorder:view',
            'workorder:create',
            'equipment:view'
        ]
    }
};

// 模拟登录验证
function mockLogin(username, password) {
    const user = mockUsers[username];
    if (user && user.password === password) {
        return {
            success: true,
            token: 'mock_token_' + Date.now(),
            userInfo: {
                username,
                role: user.role,
                name: user.name,
                permissions: user.permissions
            }
        };
    }
    return {
        success: false,
        message: '用户名或密码错误'
    };
} 